# coding=utf-8

import pika

# 连接到RabbitMQ服务器
connection = pika.BlockingConnection(pika.ConnectionParameters('10.86.3.178'))
channel = connection.channel()

queueName='GJLZHFJYXT'
# 声明队列；如果队列不存在会被创建
channel.queue_declare(queue=queueName)

# 默认情况下，RabbitMQ会把失败的消息返回给发送者
channel.basic_publish(exchange='',
                      routing_key=queueName,  # 队列名称
                      body='Hello World!')  # 消息内容

print(" [x] Sent 'Hello World!'")

# 关闭连接
connection.close()